﻿#pragma once
#include <QObject>
#include <QString>


//日志输出
 //定制消息
void customMessageHandler(QtMsgType type, const QMessageLogContext& context, const QString& msg);


class LogHelper : public QObject
{
	Q_OBJECT

public:
    static LogHelper* self;
    static  LogHelper* Instance();

	//安装消息器
	void installMessageHandler();

	//卸载消息器
	void uninstallMessageHandler();
	static void outputMessage(QtMsgType type, const QMessageLogContext& context, const QString& msg);

	//建立文件路径
	QString logPath();

	QString logTextName();
	QString logHtmlName();

    LogHelper();
    LogHelper(QObject* parent);

    ~LogHelper();
	//垃圾自动回收
	class GC
	{
	public:
		~GC();
	};

private:
	static void outputTxtMsg(const QMessageLogContext& context, const  QString& msg, QString  text);
	static void outputHtmlMsg(const QMessageLogContext& context, const  QString& msg, QString  text);

public:
signals:
	void sigDebugStrData(const QString&);
	void sigDebugHtmlData(const QString&);


};

//extern MyLog myLog;
